﻿function effect_init() {
    effect = [];
}

function effect_update() {
    var i = effect.length;
    while (i--) {
        if (effect[i].update())
            effect_remove(i);
    }
}

function effect_remove(i) {
    effect.splice(i, 1);
}

function effect_draw() {
    var i = effect.length;
    while (i--) {
        effect[i].draw();
    }
}

function effect_0(ex, ey) {
    effect[effect.length] = {x: ex, y: ey, time: 0, update: effect_update_0, draw: effect_draw_0};
}

function effect_update_0() {
    if (this.time >= 60) return true;
    this.time++;
    return false;
}

function effect_draw_0() {
    context.fillStyle = 'white';
    context.fillText ('die here!: ', this.x, this.y);
}


function effect_1(ex, ey) {
    effect[effect.length] = {x: ex, y: ey, time: 0, update: effect_update_1, draw: effect_draw_1};
}

function effect_update_1() {
    if (this.time >= 60) return true;
    this.time++;
    return false;
}

function effect_draw_1() {
    context.fillStyle = 'white';
    context.fillText ('collided!: ', this.x, this.y);
}


function effect_2(ex, ey) {
    effect[effect.length] = {x: ex, y: ey, time: 0, update: effect_update_2, draw: effect_draw_2};
}

function effect_update_2() {
    if (this.time >= 60) return true;
    this.time++;
    return false;
}

function effect_draw_2() {
    context.fillStyle = 'white';
    context.fillText ('graze!: ', this.x, this.y);
}
